package com.sywb.chuangyebao.utils;

import android.Manifest;
import android.bluetooth.BluetoothAdapter;
import android.os.Build;
import android.text.TextUtils;
import android.webkit.WebSettings;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.sywb.chuangyebao.Constants;
import com.sywb.chuangyebao.bean.AddrInfoBean;
import com.sywb.chuangyebao.bean.AlipayWeiXinIsBoundBean;
import com.sywb.chuangyebao.bean.AlipayWxWithDrawBean;
import com.sywb.chuangyebao.bean.Answer;
import com.sywb.chuangyebao.bean.BusinessBean;
import com.sywb.chuangyebao.bean.BusinessDetail;
import com.sywb.chuangyebao.bean.BusinessInfo;
import com.sywb.chuangyebao.bean.CategoryBean;
import com.sywb.chuangyebao.bean.ChatMessage;
import com.sywb.chuangyebao.bean.ChatSession;
import com.sywb.chuangyebao.bean.Column;
import com.sywb.chuangyebao.bean.Comment;
import com.sywb.chuangyebao.bean.CommentReply;
import com.sywb.chuangyebao.bean.Feedback;
import com.sywb.chuangyebao.bean.FindProjectBannerBean;
import com.sywb.chuangyebao.bean.FindProjectListBean;
import com.sywb.chuangyebao.bean.FindProjectRecommendBean;
import com.sywb.chuangyebao.bean.GoToEvaluatingBean;
import com.sywb.chuangyebao.bean.HistoryInfo;
import com.sywb.chuangyebao.bean.IncomeExpenditureBean;
import com.sywb.chuangyebao.bean.InterestIndustryInfo;
import com.sywb.chuangyebao.bean.Live;
import com.sywb.chuangyebao.bean.MessageNum;
import com.sywb.chuangyebao.bean.MyArticleBean;
import com.sywb.chuangyebao.bean.MyComment;
import com.sywb.chuangyebao.bean.NewsDetail;
import com.sywb.chuangyebao.bean.NewsOwner;
import com.sywb.chuangyebao.bean.Notice;
import com.sywb.chuangyebao.bean.NotificationInfo;
import com.sywb.chuangyebao.bean.OpenAd;
import com.sywb.chuangyebao.bean.Page;
import com.sywb.chuangyebao.bean.QARichInfo;
import com.sywb.chuangyebao.bean.Question;
import com.sywb.chuangyebao.bean.SuperInfo;
import com.sywb.chuangyebao.bean.Topic;
import com.sywb.chuangyebao.bean.TrainingInfo;
import com.sywb.chuangyebao.bean.User;
import com.sywb.chuangyebao.bean.UserAnswer;
import com.sywb.chuangyebao.bean.UserData;
import com.sywb.chuangyebao.bean.UserFavorite;
import com.sywb.chuangyebao.bean.UserFriend;
import com.sywb.chuangyebao.bean.UserIndex;
import com.sywb.chuangyebao.bean.UserInfo;
import com.sywb.chuangyebao.bean.UserToken;
import com.sywb.chuangyebao.bean.VersionInfo;
import com.sywb.chuangyebao.bean.VideoDataDetail;
import com.sywb.chuangyebao.bean.VideoDetail;
import com.sywb.chuangyebao.bean.VideoInfo;
import com.sywb.chuangyebao.bean.WxInfo;

import net.vidageek.mirror.dsl.Mirror;

import org.bining.footstone.App;
import org.bining.footstone.http.OkGo;
import org.bining.footstone.http.callback.JsonCallback;
import org.bining.footstone.http.model.HttpParams;
import org.bining.footstone.http.request.PostRequest;
import org.bining.footstone.log.Logger;
import org.bining.footstone.utils.ApkUtils;
import org.bining.footstone.utils.NetUtils;
import org.bining.footstone.utils.SharedUtils;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

public class HttpUtils {

    /**
     * 获取Http访问的域名
     */
    public static String getHttpUrl() {
        if (App.isDebug()) {
            return Constants.DNS_ADDRESS_DEV;
        } else {
            return Constants.DNS_ADDRESS_ONLINE;
        }
    }

    private static String getUserAgent() {
        String userAgent = "";
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            try {
                userAgent = WebSettings.getDefaultUserAgent(App.app());
            } catch (Exception e) {
                userAgent = System.getProperty("http.agent");
            }
        } else {
            userAgent = System.getProperty("http.agent");
        }
        StringBuffer sb = new StringBuffer();
        for (int i = 0, length = userAgent.length(); i < length; i++) {
            char c = userAgent.charAt(i);
            if (c <= '\u001f' || c >= '\u007f') {
                sb.append(String.format("\\u%04x", (int) c));
            } else {
                sb.append(c);
            }
        }
        sb.append(" ChuangYeBao/").append(ApkUtils.getVersionName());
        sb.append(" NetType/").append(NetUtils.getNetworkTypeName());
        sb.append(" Language/").append(Locale.getDefault().getLanguage()).append("_").append(Locale.getDefault().getCountry());

        return sb.toString();
    }

    private static String getPhoneInfo() {
        HashMap<String, Object> phoneMap = ApkUtils.getPhoneAllInfo();
        phoneMap.put("wlan_mac", NetUtils.getWlanMac());
        phoneMap.put("mobi_mac", NetUtils.getMobiMac());
        phoneMap.put("bule_mac", getBtAddressViaReflection());
        phoneMap.put("alideviceid", SharedUtils.getString(Constants.USERDEVICEID));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && ApkUtils.lacksPermission(Manifest.permission.READ_PHONE_STATE)) {
            phoneMap.put("IMEI2", ApkUtils.getPhoneGsmIMEI());
            phoneMap.put("MEID", ApkUtils.getPhoneCdmaMEID());
        }
        return JSON.toJSONString(phoneMap);
    }

    private static String getBtAddressViaReflection() {
        try {
            BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
            if (bluetoothAdapter == null) {
                return "";
            }
            Object bluetoothManagerService = new Mirror().on(bluetoothAdapter).get().field("mService");
            if (bluetoothManagerService == null) {
                return "";
            }
            Object address = new Mirror().on(bluetoothManagerService).invoke().method("getAddress").withoutArgs();
            if (address != null && address instanceof String) {
                return (String) address;
            } else {
                return "";
            }
        } catch (Exception e) {
            return "";
        }
    }

    public static <T extends Object> void getHttp(String mothedUrl, HttpParams httpParams, JsonCallback<T> httpCallback) {
        httpParams.put("version", ApkUtils.getVersionName());
        httpParams.put("ch", ApkUtils.getMetaData(App.app(), "UMENG_CHANNEL").toString());
        OkGo.<T>get(mothedUrl).tag(mothedUrl)
                .removeHeader("User-Agent")
                .headers("User-Agent", getUserAgent())
                .headers("uid", SharedUtils.getString(Constants.USEROPENID, ""))
                .headers("token", SharedUtils.getString(Constants.USERACCESSTOKEN, ""))
                .headers("deviceid", SharedUtils.getString(Constants.USERDEVICEID, ""))
                .params(httpParams).execute(httpCallback);
    }

    public static <T extends Object> void getHttp(String mothedUrl, HashMap<String, Object> params, HttpCallback<?> asyncCallBack) {

        HttpRetryCallback httpRetryCallback = new HttpRetryCallback();
        httpRetryCallback.cacheRequest(1, mothedUrl, JSON.toJSONString(params), asyncCallBack);

        HttpParams httpParams = new HttpParams();
        if (params != null && params.size() > 0) {
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                if (entry != null && entry.getKey() != null && entry.getValue() != null) {
                    httpParams.put(entry.getKey(), entry.getValue().toString());
                }
            }
        }

        getHttp(mothedUrl, httpParams, httpRetryCallback);
    }

    public static <T extends Object> void postHttp(String mothedUrl, String paramsAes, JsonCallback<T> httpCallback) {
        StringBuilder url = new StringBuilder();
        url.append(getHttpUrl()).append(mothedUrl).append("?").append("version").append("=").append(ApkUtils.getVersionName()).append("&ch=").append(ApkUtils.getMetaData(App.app(), "UMENG_CHANNEL"));
        OkGo.<T>post(url.toString()).tag(url.toString())
                .removeHeader("User-Agent")
                .headers("User-Agent", getUserAgent())
                .headers("uid", SharedUtils.getString(Constants.USEROPENID, ""))
                .headers("token", SharedUtils.getString(Constants.USERACCESSTOKEN, ""))
                .headers("deviceid", SharedUtils.getString(Constants.USERDEVICEID, ""))
                .upString(paramsAes).execute(httpCallback);
    }


    public static void postHttp(String mothedUrl, LinkedHashMap<String, Object> paramsMap, HttpCallback<?> asyncCallBack) {
        paramsMap.put("encrypt_time", System.currentTimeMillis() / 1000);
        String paramsJson = JSON.toJSONString(paramsMap);
        Logger.e("paramsJson:" + mothedUrl + ":" + paramsJson);

        String paramsAES = AESUtils.encrypt(paramsJson);
        HttpRetryCallback httpRetryCallback = new HttpRetryCallback();
        httpRetryCallback.cacheRequest(2, mothedUrl, paramsJson, asyncCallBack);

        postHttp(mothedUrl, paramsAES, httpRetryCallback);
    }

    public static <T extends Object> void uploadHttp(String mothedUrl, List<File> file, JsonCallback<T> httpCallback) {
        StringBuilder url = new StringBuilder();
        url.append(getHttpUrl()).append(mothedUrl).append("?").append("version").append("=").append(ApkUtils.getVersionName()).append("&ch=").append(ApkUtils.getMetaData(App.app(), "UMENG_CHANNEL"));
        PostRequest request = OkGo.<T>post(url.toString()).tag(url.toString())
                .removeHeader("User-Agent")
                .headers("User-Agent", getUserAgent())
                .headers("uid", SharedUtils.getString(Constants.USEROPENID, ""))
                .headers("token", SharedUtils.getString(Constants.USERACCESSTOKEN, ""))
                .headers("deviceid", SharedUtils.getString(Constants.USERDEVICEID, ""));
        for (int i = 0; i < file.size(); i++) {
            request.params("file" + i, file.get(i));
        }
        request.execute(httpCallback);
    }

    public static void uploadHttp(List<File> fileList, HttpCallback<?> asyncCallBack) {
        List<String> pathList = new ArrayList<>();
        for (File file : fileList) {
            pathList.add(file.getAbsolutePath());
        }
        HttpRetryCallback httpRetryCallback = new HttpRetryCallback();
        httpRetryCallback.cacheRequest(3, Constants.HTTP_FILE_UPLOAD, JSON.toJSONString(pathList), asyncCallBack);
        uploadHttp(Constants.HTTP_FILE_UPLOAD, fileList, httpRetryCallback);
    }

    public static void uploadHttp(File file, HttpCallback<?> asyncCallBack) {
        List<File> fileList = new ArrayList<>();
        fileList.add(file);
        uploadHttp(fileList, asyncCallBack);
    }

    public static void loginToQQ(String data, HttpCallback<UserInfo> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = JSON.parseObject(data, new TypeReference<LinkedHashMap<String, Object>>() {
        });
        paramsMap.put("facility", getPhoneInfo());
        postHttp(Constants.HTTP_LOGIN_QQ, paramsMap, httpCallback);
    }

    public static void loginToWeixin(String code, HttpCallback<UserInfo> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("code", code);
        paramsMap.put("facility", getPhoneInfo());
        postHttp(Constants.HTTP_LOGIN_WEIXIN, paramsMap, httpCallback);
    }

    public static void loginToSina(String data, HttpCallback<UserInfo> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = JSON.parseObject(data, new TypeReference<LinkedHashMap<String, Object>>() {
        });
        paramsMap.put("facility", getPhoneInfo());
        postHttp(Constants.HTTP_LOGIN_SINA, paramsMap, httpCallback);
    }

    public static void loginToSina(Object uid, Object access_token, Object expires_in, Object refresh_token, Object expires_time, HttpCallback<UserInfo> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        paramsMap.put("access_token", access_token);
        paramsMap.put("expires_in", expires_in);
        paramsMap.put("refresh_token", refresh_token);
        paramsMap.put("expires_time", expires_time);
        paramsMap.put("facility", getPhoneInfo());
        postHttp(Constants.HTTP_LOGIN_SINA, paramsMap, httpCallback);
    }

    public static void login(HttpCallback<UserInfo> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("mobile", SharedUtils.getString(Constants.USERACCOUNT));
        paramsMap.put("password", SharedUtils.getString(Constants.USERPASSWORD));
        paramsMap.put("facility", getPhoneInfo());
        postHttp(Constants.HTTP_SSO_LOGIN, paramsMap, httpCallback);
    }

    public static void logout(HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        getHttp(getHttpUrl() + Constants.HTTP_SSO_LOGOUT, paramsMap, httpCallback);
    }

    public static void signup(HttpCallback<UserInfo> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("mobile", SharedUtils.getString(Constants.USERACCOUNT));
        paramsMap.put("captcha", SharedUtils.getString(Constants.USERCAPTCHA));
        paramsMap.put("password", SharedUtils.getString(Constants.USERPASSWORD));
        paramsMap.put("facility", getPhoneInfo());
        postHttp(Constants.HTTP_SSO_SIGNUP, paramsMap, httpCallback);
    }

    public static void bind(HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("mobile", SharedUtils.getString(Constants.USERACCOUNT));
        paramsMap.put("captcha", SharedUtils.getString(Constants.USERCAPTCHA));
        postHttp(Constants.HTTP_SSO_BIND, paramsMap, httpCallback);
    }

    public static void resetPassword(HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("mobile", SharedUtils.getString(Constants.USERACCOUNT));
        paramsMap.put("captcha", SharedUtils.getString(Constants.USERCAPTCHA));
        paramsMap.put("password", SharedUtils.getString(Constants.USERPASSWORD));
        postHttp(Constants.HTTP_SSO_RESSETPWD, paramsMap, httpCallback);
    }

    public static void sendCaptcha(String mobile, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("mobile", mobile);
        postHttp(Constants.HTTP_SMS_CAPTCHA, paramsMap, httpCallback);
    }

    public static void ssoExists(String mobile, HttpCallback<Boolean> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("mobile", mobile);
        postHttp(Constants.HTTP_SSO_EXISTS, paramsMap, httpCallback);
    }

    public static void refreshToken(String refreshToken, HttpCallback<UserToken> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", SharedUtils.getString(Constants.USEROPENID, ""));
        paramsMap.put("refresh_token", refreshToken);
        postHttp(Constants.HTTP_SSO_REFRESHTOKEN, paramsMap, httpCallback);
    }

    public static void getUserInfo(HttpCallback<UserInfo> httpCallback) {
        getHttp(getHttpUrl() + Constants.HTTP_SSO_USERINFO, null, httpCallback);
    }

    public static void getUserData(HttpCallback<UserData> httpCallback) {
        getHttp(getHttpUrl() + Constants.HTTP_SSO_GETPROFILE, null, httpCallback);
    }

    /**
     * 修改用户信息
     *
     * @param userName 用户名
     * @param nickName 用户昵称
     */
    public static void updateUserInfo(String userName, String nickName, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", SharedUtils.getString(Constants.USEROPENID));
        paramsMap.put("access_token", SharedUtils.getString(Constants.USERACCESSTOKEN));
        if (userName != null) {
            paramsMap.put("user_name", userName);
        }
        if (nickName != null) {
            paramsMap.put("nickname", nickName);
        }
        postHttp(Constants.HTTP_SSO_UPDATEUSERINFO, paramsMap, httpCallback);
    }

    /**
     * 修改用户资料
     * display_name:真实姓名
     * gender:性别(1=男 2=女)
     * birth_year:出生年
     * birth_month:出生月
     * birth_day:出生日
     * birth_area_id:出生地区ID
     * blood_type:血型(0=unknown 1=A 2=B 3=O 4=AB 5=Other)
     * live_area_id:居住地区ID
     * brief_intro:简介
     * phone_no:固定电话号码
     * mobile_no:手机号码
     * email:电子邮箱
     * area:地区
     * ddress:地址
     * postalcode:邮编
     * qq:QQ
     * msn:MSN
     * profile_photo:头像
     */
    public static void updateUserData(String[] keys, Object[] params, HttpCallback<String> httpCallback) {
        if (keys == null || params == null || keys.length != params.length) {
            httpCallback.onError("参数错误");
        } else {
            LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
            paramsMap.put("uid", SharedUtils.getString(Constants.USEROPENID));
            paramsMap.put("access_token", SharedUtils.getString(Constants.USERACCESSTOKEN));
            for (int i = 0; i < keys.length; i++) {
                paramsMap.put(keys[i], params[i]);
            }
            postHttp(Constants.HTTP_SSO_UPDATEPROFILE, paramsMap, httpCallback);
        }
    }

    /**
     * 我的回答
     *
     * @param is_add TRUE为已回答,false为未回答
     */
    public static void wendaList(boolean is_add, int pageNo, HttpCallback<List<UserAnswer>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("is_add", is_add);
        paramsMap.put("limit", Constants.PAGESIZE);
        paramsMap.put("page", pageNo);
        postHttp(Constants.HTTP_WENDA_LIST, paramsMap, httpCallback);
    }

    /**
     * 我的提问
     */
    public static void wendaQuestion(int pageNo, HttpCallback<List<Question>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("limit", Constants.PAGESIZE);
        paramsMap.put("page", pageNo);
        postHttp(Constants.HTTP_WENDA_QUESTION, paramsMap, httpCallback);
    }

    /**
     * 我的好友（关注/粉丝）
     *
     * @param type topic_id为关注 默认 from_uid为粉丝  topic为话题
     */
    public static void followList(String type, int pageNo, HttpCallback<List<UserFriend>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("type", type);
        paramsMap.put("limit", Constants.PAGESIZE);
        paramsMap.put("page", pageNo);
        postHttp(Constants.HTTP_FOLLOW_LIST, paramsMap, httpCallback);
    }

    /**
     * 我的收藏
     */
    public static void favoriteList(int pageNo, HttpCallback<List<UserFavorite>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("limit", Constants.PAGESIZE);
        paramsMap.put("page", pageNo);
        postHttp(Constants.HTTP_FAVORITE_LIST, paramsMap, httpCallback);
    }

    /**
     * 获取文件配置信息
     */
    public static void getFileConfig(HttpCallback<String> httpCallback) {
        getHttp(getHttpUrl() + Constants.HTTP_FILE_CONFIG, null, httpCallback);
    }

    /**
     * 阿里云推送测试
     */
    public static void pushData(HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("Target", "ACCOUNT");// 推送目标: DEVICE:推送给设备; ACCOUNT:推送给指定帐号,TAG:推送给自定义标签; ALL: 推送给全部
        paramsMap.put("TargetValue", "995601");// 根据Target来设定，如Target=device, 则对应的值为 设备id1,设备id2. 多个值使用逗号分隔.(帐号与设备有一次最多100个的限制)
        paramsMap.put("DeviceType", "ANDROID"); // 设备类型 ANDROID iOS ALL.
        paramsMap.put("PushType", "NOTICE");// 消息类型 MESSAGE NOTICE
        paramsMap.put("Title", "新消息提醒");// 消息的标题
        paramsMap.put("Body", "您有一条新消息");// 消息的内容
        paramsMap.put("AndroidNotifyType", "BOTH");// 通知的提醒方式 "VIBRATE" : 震动 "SOUND" : 声音 "BOTH" : 声音和震动 NONE : 静音
        paramsMap.put("AndroidNotificationBarType", "1");// 通知栏自定义样式0-100
        paramsMap.put("AndroidOpenType", "NONE");// // 点击通知后动作 "APPLICATION" : 打开应用 "ACTIVITY" : 打开AndroidActivity "URL" : 打开URL "NONE" : 无跳转
        paramsMap.put("AndroidOpenUrl", "http://www.3158.com");// Android收到推送后打开对应的url,仅当AndroidOpenType="URL"有效
        paramsMap.put("AndroidActivity", "com.sywb.chuangyebao.view.UserMessageActivity");// 设定通知打开的activity，仅当AndroidOpenType="Activity"有效
        paramsMap.put("AndroidMusic", "default");// Android通知音乐
        paramsMap.put("AndroidExtParameters", "{\"topic_id\":\"4613415\",\"topic_type\":\"article\"}");// 设定android类型设备通知的扩展属性
        getHttp("http://push.work.1e100.top/push_debug.php", paramsMap, httpCallback);
    }

    /**
     * 获取文章详情
     */
    public static void getArticleContent(int articleId, HttpCallback<NewsDetail> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("article_id", articleId);
        postHttp(Constants.HTTP_ARTICLE_CONTENT, paramsMap, httpCallback);
    }

    /**
     * 获取直播地址
     */
    public static void getRoomLiveUrl(String roomId, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("room_id", roomId);
        postHttp(Constants.HTTP_ROOM_LIVEURL, paramsMap, httpCallback);
    }

    /**
     * 获取直播列表
     */
    public static void getCreateTvList(int lastIndex, HttpCallback<List<BusinessInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("last_index", lastIndex);
        postHttp(Constants.HTTP_CREATETV_LIST, paramsMap, httpCallback);
    }

    /**
     * 预约直播
     */
    public static void getCreateTvReservation(int index, String tvp_id, HttpCallback<Boolean> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("index", index);
        paramsMap.put("tvp_id", tvp_id);
        postHttp(Constants.HTTP_CREATETV_RESERVATION, paramsMap, httpCallback);
    }

    /**
     * 获取问答分类
     */
    public static void listCategory(long parent_id, HttpCallback<List<InterestIndustryInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("parent_id", parent_id);
        postHttp(Constants.POST_LIST_CATEGORY, paramsMap, httpCallback);
    }

    /**
     * 获取用户（导师）列表
     *
     * @param category      分类Id
     * @param limit         一页显示数量
     * @param pageNo        当前页号
     * @param verify_login  是否验证登录（登录与非登录返回值不一样）
     * @param user_group_id 用户类型，获取所有传值：-1
     * @param questionId    问题id（邀请列表时使用）
     * @param keyword       搜索关键字
     * @param type          传 follow 为查询好友
     */
    public static void listUserTutor(int category, int limit, int pageNo, boolean verify_login, int user_group_id, int questionId, String keyword, String type, HttpCallback<Page<User>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("categoryId", category);
        paramsMap.put("limit", limit);
        paramsMap.put("page", pageNo);
        paramsMap.put("verify_login", verify_login);
        paramsMap.put("user_group_id", user_group_id);
        paramsMap.put("questionId", String.valueOf(questionId));
        paramsMap.put("keyword", keyword);
        paramsMap.put("type", type);
        postHttp(Constants.POST_LIST_TUTOR, paramsMap, httpCallback);
    }

    /**
     * 获取提问列表
     *
     * @param category 问答分类,不传为获取不分类列表
     * @param flag     是否获取自己发布的问题 0:全部 1:自己发布
     * @param topic_id 话题ID
     * @param pageNo   页码
     */
    public static void listQuestions(int category, int flag, long topic_id, int pageNo, HttpCallback<Page<Question>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("categoryId", category);
        paramsMap.put("flag", flag);
        paramsMap.put("topic_id", topic_id);
        paramsMap.put("page", pageNo);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_LIST_QUESTION, paramsMap, httpCallback);
    }

    public static void getQuestion(long askId, HttpCallback<Question> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("askId", askId);
        postHttp(Constants.POST_GET_QUESTION, paramsMap, httpCallback);
    }

    /**
     * 发布提问
     */
    public static void saveQuestion(String text, List<String> images, String audio, List<QARichInfo> richInfoList, long topicId, int audioLength, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("text", text);
        paramsMap.put("images", JSON.toJSONString(images));
        paramsMap.put("audio", audio);
        paramsMap.put("richInfoList", JSON.toJSONString(richInfoList));
        paramsMap.put("topicId", topicId);
        paramsMap.put("source_id", Constants.SOURCE_ID_ANDROID);
        paramsMap.put("audioLength", audioLength);
        postHttp(Constants.POST_SAVE_QUESTION, paramsMap, httpCallback);
    }

    //TODO
    public static void deleteQuestion(long askId, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("id", askId);
        postHttp(Constants.POST_DELETE_QUESTION, paramsMap, httpCallback);
    }

    public static void listAnswers(long askId, String sort, int pageNo, HttpCallback<Page<Answer>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("askId", askId);
        paramsMap.put("sort", sort);
        paramsMap.put("page", pageNo);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_LIST_ANSWER, paramsMap, httpCallback);
    }

    public static void getAnswer(long answerId, HttpCallback<Answer> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("answerId", answerId);
        postHttp(Constants.POST_GET_ANSWER, paramsMap, httpCallback);
    }

    public static void saveAnswer(long question_id, String text, List<String> images, String audio, List<QARichInfo> richInfoList, int audioLength, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("question_id", question_id);
        paramsMap.put("text", text);
        paramsMap.put("img", JSON.toJSONString(images));
        paramsMap.put("audio", audio);
        if (richInfoList != null && richInfoList.size() > 0) {
            paramsMap.put("richInfoList", JSON.toJSONString(richInfoList));
        }
        paramsMap.put("source_id", Constants.SOURCE_ID_ANDROID);
        paramsMap.put("audioLength", audioLength);
        postHttp(Constants.POST_SAVE_ANSWER, paramsMap, httpCallback);
    }

    /**
     * 获取问答评论或回复列表
     *
     * @param answerId 评论时为answerId 回复时为node
     * @param type     数据类型：comment=评论，reply=回复
     */
    public static void listComments(int answerId, int pageNo, String type, String node, HttpCallback<Page<Answer>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("answerId", answerId);
        paramsMap.put("limit", Constants.PAGESIZE);
        paramsMap.put("page", pageNo);
        paramsMap.put("type", type);
        paramsMap.put("node", node);
        postHttp(Constants.POST_LIST_COMMENT, paramsMap, httpCallback);
    }

    /**
     * 发布问答评论
     *
     * @param answerId
     * @param text
     * @param relation_id
     * @param node
     * @param question_id
     * @param httpCallback
     */
    public static void saveComment(long answerId, String text, long relation_id, String node, int question_id, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("question_id", question_id);
        paramsMap.put("answerId", answerId);
        paramsMap.put("text", text);
        paramsMap.put("relation_id", relation_id);
        paramsMap.put("source_id", Constants.SOURCE_ID_ANDROID);
        paramsMap.put("node", node);
        postHttp(Constants.POST_SAVE_COMMENT, paramsMap, httpCallback);
    }

    /**
     * 获取话题聚合页信息
     */
    public static void getTopic(int topicId, HttpCallback<Topic> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("topic_id", topicId);
        postHttp(Constants.POST_GET_TOPIC, paramsMap, httpCallback);
    }

    /**
     * 关注/取消关注
     *
     * @param topic_id   被关注对象id
     * @param is_add     true=关注，false=取消关注
     * @param topic_type user=关注的人
     */
    public static void follow(long topic_id, String topic_type, boolean is_add, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("topic_id", topic_id);
        paramsMap.put("is_add", is_add);
        paramsMap.put("topic_type", topic_type);
        postHttp(Constants.POST_FOLLOW, paramsMap, httpCallback);
    }

    /**
     * 点赞/取消点赞
     *
     * @param topic_type 主题(question:提问，answer:回答，comment:评论) 文章：article 视频：video
     * @param topic_id   点赞或取消点赞的ID
     * @param is_add     是否点赞：false=取消点赞 ， true=点赞）
     */
    public static void agree(String topic_type, int topic_id, boolean is_add, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("topic_type", topic_type);
        paramsMap.put("topic_id", topic_id);
        paramsMap.put("thumb", 1);
        paramsMap.put("is_add", is_add);
        postHttp(Constants.POST_THUMB, paramsMap, httpCallback);
    }

    /**
     * 收藏/取消收藏
     *
     * @param topic_type 主题 question：问题，topic:话题 文章：article 视频video 音频：audio
     * @param topic_id   收藏/取消收藏的ID
     * @param is_add     是否收藏 ：true=收藏，false=取消收藏
     */

    public static void favorite(String topic_type, long topic_id, boolean is_add, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("topic_type", topic_type);
        paramsMap.put("topic_id", topic_id);
        paramsMap.put("is_add", is_add);
        postHttp(Constants.POST_FAVORITE, paramsMap, httpCallback);
    }

    /**
     * 获取评论列表
     *
     * @param topic_type 类型 文章：article 视频：video
     * @param topicId    文章或视频ID
     * @param pageNo     页数
     */
    public static void listComment(String topic_type, int topicId, int pageNo, HttpCallback<List<Comment>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("topic_type", topic_type);
        paramsMap.put("topic_id", topicId);
        paramsMap.put("page", pageNo);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.HTTP_COMMENT_LIST, paramsMap, httpCallback);
    }

    /**
     * 添加评论
     *
     * @param topic_type
     * @param topicId
     * @param content    评论内容
     */
    public static void addComment(String topic_type, int topicId, String content, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("topic_type", topic_type);
        paramsMap.put("topic_id", topicId);
        paramsMap.put("content", content);
        postHttp(Constants.HTTP_COMMENT_ADD, paramsMap, httpCallback);
    }

    /**
     * 删除评论
     *
     * @param commentId 评论ID
     */
    public static void delComment(int commentId, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("comment_id", commentId);
        postHttp(Constants.HTTP_COMMENT_DEL, paramsMap, httpCallback);
    }

    /**
     * 评论回复列表
     *
     * @param commentId 评论ID
     */
    public static void listCommentReply(int commentId, int pageNo, HttpCallback<List<CommentReply>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("comment_id", commentId);
        paramsMap.put("page", pageNo);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.HTTP_COMMENTREPLY_LIST, paramsMap, httpCallback);
    }

    /**
     * 添加评论回复
     *
     * @param replyType 回复目标类型 'comment'或 'reply'
     * @param replyId   回复目标ID，当类型为comment时，该值为回复的评论ID
     * @param commentId 回复的评论ID
     * @param toUid     回复目标用户ID
     * @param content   回复内容
     */
    public static void addCommentReply(String replyType, int replyId, int commentId, int toUid, String content, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("reply_type", replyType);
        paramsMap.put("reply_id", replyId);
        paramsMap.put("comment_id", commentId);
        paramsMap.put("to_uid", toUid);
        paramsMap.put("content", content);
        postHttp(Constants.HTTP_COMMENTREPLY_ADD, paramsMap, httpCallback);
    }

    /**
     * 删除评论回复
     *
     * @param replyId 评论回复ID
     */
    public static void delCommentReply(int replyId, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("reply_id", replyId);
        postHttp(Constants.HTTP_COMMENTREPLY_DEL, paramsMap, httpCallback);
    }

    /**
     * 获取培训首页数据
     */
    public static void trainingHome(HttpCallback<TrainingInfo> httpCallback) {
        postHttp(Constants.HTTP_TRAINING_HOME, new LinkedHashMap<String, Object>(), httpCallback);
    }

    /**
     * 获取视频、培训视频、培训音频列表
     *
     * @param uid         用户ID：-1=所有视频，用户ID=该用户的视频列表
     * @param media_type  1=视频，2=音频
     * @param page        分页
     * @param category_id 类目id 1=普通视频 2=培训视频
     */
    public static void getVideoList(int media_type, int uid, int page, int category_id, HttpCallback<Page<VideoInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        paramsMap.put("type", media_type);
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        paramsMap.put("category_id", category_id);
        postHttp(Constants.HTTP_VIDEO_LIST, paramsMap, httpCallback);
    }

    /**
     * 获取视频、培训视频、培训音频详情
     *
     * @param media_id     音频或视频ID
     * @param httpCallback
     */
    public static void getVideoDetail(int media_id, HttpCallback<VideoDetail> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("media_id", media_id);
        postHttp(Constants.HTTP_VIDEO_INFO, paramsMap, httpCallback);
    }

    /**
     * 获取视频详情
     *
     * @param video_id     视频ID
     * @param httpCallback
     */
    public static void getVideoInfo(int video_id, HttpCallback<VideoDataDetail> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("video_id", video_id);
        postHttp(Constants.HTTP_VIDEO_DETAIL, paramsMap, httpCallback);
    }

    /**
     * 获取培训专栏列表
     *
     * @param page
     * @param httpCallback
     */
    public static void listColumn(int page, HttpCallback<Page<Column>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_LIST_COLUMN, paramsMap, httpCallback);
    }

    /**
     * 获取培训专栏详情
     *
     * @param column_id
     * @param httpCallback
     */
    public static void getColumn(int column_id, HttpCallback<Column> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("column_id", column_id);
        postHttp(Constants.POST_GET_COLUMN, paramsMap, httpCallback);
    }

    /**
     * 获取培训直播列表
     *
     * @param page
     * @param httpCallback
     */
    public static void listLive(int page, HttpCallback<Page<Live>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_LIST_LIVE, paramsMap, httpCallback);
    }

    /**
     * 搜索热门词汇
     */
    public static void searchHot(HttpCallback<List<String>> httpCallback) {
        getHttp(getHttpUrl() + Constants.POST_SEARCH_HOT, null, httpCallback);
    }

    /**
     * 推荐列表
     */
    public static void recommendList(int num, int page, HttpCallback<List<SuperInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("num", num);
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_RECOMMEND_LIST, paramsMap, httpCallback);
    }

    /**
     * 关注列表
     */
    public static void dynamicList(int page, HttpCallback<List<SuperInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_DYNAMIC_LIST, paramsMap, httpCallback);
    }

    /**
     * 关注列表无数据时推荐关注用户
     */
    public static void dynamicUser(HttpCallback<List<NewsOwner>> httpCallback) {
        postHttp(Constants.POST_DYNAMIC_USER, new LinkedHashMap<String, Object>(), httpCallback);
    }

    /**
     * 项目号动态
     */
    public static void dynamicByProject(int page, HttpCallback<List<SuperInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_DYNAMIC_PROJECT, paramsMap, httpCallback);
    }

    /**
     * 用户主页动态列表
     */
    public static void dynamicListById(int uid, int page, HttpCallback<List<SuperInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_DYNAMIC_LISTBYID, paramsMap, httpCallback);
    }

    /**
     * 意见反馈列表
     */
    public static void listFeedbacks(int page, HttpCallback<List<Feedback>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.HTTP_LIST_FEEDBACK, paramsMap, httpCallback);
    }

    /**
     * 添加意见反馈
     *
     * @param cont 问题描述
     */
    public static void addFeedback(String cont, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("cont", cont);
        postHttp(Constants.HTTP_ADD_FEEDBACK, paramsMap, httpCallback);
    }

    /**
     * 报名
     *
     * @param categoryId 行业选择 分类ID
     * @param city       所属城市 如 北京市东城区
     * @param desc       报道简介
     * @param contacts   联系人
     * @param phone      联系电话
     */
    public static void enrollAdd(int categoryId, String city, String desc, String contacts, String phone, HttpCallback httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("categoryid", categoryId);
        paramsMap.put("city", city);
        paramsMap.put("contacts", contacts);
        paramsMap.put("phone", phone);
        paramsMap.put("desc", desc);
        postHttp(Constants.POST_ENROLL_ADD, paramsMap, httpCallback);
    }

    /**
     * 邀请回答问题
     *
     * @param user_id     邀请的人的id
     * @param question_id 邀请回答的问题id
     */
    public static void invite(int user_id, int question_id, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("user_id", user_id);
        paramsMap.put("question_id", question_id);
        postHttp(Constants.POST_LIST_INVITE, paramsMap, httpCallback);
    }

    /**
     * 根据用户ID获取用户信息
     */
    public static void getUser(int uid, HttpCallback<UserIndex> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        postHttp(Constants.POST_GET_USER, paramsMap, httpCallback);
    }

    /**
     * 通用交互提交分享删除|分享举报
     *
     * @param topic_type 提交类型
     * @param topic_id   提交id
     * @param is_type    提交类型 1 举报 2 删除
     */
    public static void report(String topic_type, int topic_id, int is_type, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("topic_type", topic_type);
        paramsMap.put("topic_id", topic_id);
        paramsMap.put("is_type", is_type);
        paramsMap.put("cont", "");//	提交原因，暂时没有
        postHttp(Constants.POST_REPORT, paramsMap, httpCallback);
    }

    /**
     * 拉黑用户
     *
     * @param uid
     */
    public static void shield(int uid, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        postHttp(Constants.POST_CHAT_SHIELD, paramsMap, httpCallback);
    }

    /**
     * 是否已拉黑用户
     *
     * @param uid
     */
    public static void isShield(String uid, HttpCallback<Boolean> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        postHttp(Constants.POST_CHAT_ISSHIELD, paramsMap, httpCallback);
    }

    /**
     * 用户私信会话列表
     */
    public static void chatConcat(HttpCallback<List<ChatSession>> httpCallback) {
        postHttp(Constants.POST_CHAT_CONCAT, new LinkedHashMap<String, Object>(), httpCallback);
    }

    public static void chatMessage(int uid, HttpCallback<List<ChatMessage>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        postHttp(Constants.POST_CHAT_MESSAGE, paramsMap, httpCallback);
    }

    public static void chatSend(int uid, String message, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", uid);
        paramsMap.put("msg", message);
        postHttp(Constants.POST_CHAT_SEND, paramsMap, httpCallback);
    }

    /**
     * 获取畅谈通代码
     *
     * @param project_id
     * @param company_id
     * @param httpCallback
     */
    public static void getCode(int project_id, int company_id, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("project_id", project_id);
        paramsMap.put("company_id", company_id);
        postHttp(Constants.POST_GET_CODE, paramsMap, httpCallback);
    }

    /**
     * 修改创业时期、兴趣行业、投资预算 公用接口
     *
     * @param cyState          如有大于0，表示要修改创业时期
     * @param categoryId       如果不为空，表示要修改兴趣行业
     * @param investmentBudget 如有大于0，表示要修改投资预算
     * @param httpCallback
     */
    public static void goodatUpdate(int cyState, String categoryId, int investmentBudget, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        if (cyState > 0) {
            paramsMap.put("cy_state", cyState);
        }
        if (!TextUtils.isEmpty(categoryId)) {
            paramsMap.put("category_id", categoryId);
        }
        if (investmentBudget > 0) {
            paramsMap.put("investment_budget", investmentBudget);
        }
        postHttp(Constants.POST_GOODAT_UPDATE, paramsMap, httpCallback);
    }

    public static void getShareUrl(String type, int id, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("type", type);
        paramsMap.put("id", id);
        postHttp(Constants.POST_GET_SHARE, paramsMap, httpCallback);
    }

    public static void listNotice(int page, HttpCallback<List<Notice>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.HTTP_LIST_NOTICE, paramsMap, httpCallback);
    }

    public static void getMyMsgNum(HttpCallback<MessageNum> httpCallback) {
        postHttp(Constants.POST_MY_MSGNUM, new LinkedHashMap<String, Object>(), httpCallback);
    }

    public static void getMyNote(int page, HttpCallback<List<NotificationInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_MY_NOTE, paramsMap, httpCallback);
    }

    /**
     * 设置公告已读
     *
     * @param chattingId 公告ID
     */
    public static void chattingRead(int chattingId, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("chatting_id", chattingId);
        postHttp(Constants.POST_CHATTING_READ, paramsMap, httpCallback);
    }

    /**
     * 微信信息
     */
    public static void getWx(HttpCallback<WxInfo> httpCallback) {
        getHttp(getHttpUrl() + Constants.POST_ABOUT_WEIXIN, new LinkedHashMap<String, Object>(), httpCallback);
    }

    /**
     * 获取内容列表 包括文章、提问、视频、用户等数据，支持关键词搜索
     *
     * @param itemType    类型,多个用[,]分割 all:综合 article:文章 question:提问 video:视频 user:用户
     * @param uid         用户UID
     * @param keyword     关键字
     * @param page        页码
     * @param flag        标志位 c:推荐
     * @param type        类型，一般与item_type配合使用。媒体类型：1=视频 2=音频
     * @param category_id 分类ID，一般与item_type配合使用。
     */
    public static void getContentList(String itemType, String uid, String keyword, int page, String flag, String type, String category_id, HttpCallback<List<SuperInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("item_type", itemType);
        if (uid != null) {
            paramsMap.put("uid", uid);
        }
        if (keyword != null) {
            paramsMap.put("keyword", keyword);
        }
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        if (flag != null) {
            paramsMap.put("flag", flag);
        }
        if (type != null) {
            paramsMap.put("type", type);
        }
        if (category_id != null) {
            paramsMap.put("category_id", category_id);
        }
        postHttp(Constants.POST_CONTENT_LIST, paramsMap, httpCallback);
    }

    /**
     * 获取最新版本信息
     */
    public static void getVersion(String appmark, HttpCallback<VersionInfo> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("platfrom", 1);
        paramsMap.put("market", appmark);
        paramsMap.put("sign_up_source", getPhoneInfo());
        postHttp(Constants.POST_ABOUT_VERSION, paramsMap, httpCallback);
    }

    /**
     * 获取开屏广告
     */
    public static void getAd(String ratio, HttpCallback<OpenAd> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("source", Constants.SOURCE_ID_ANDROID);
        paramsMap.put("ratio", ratio);
        postHttp(Constants.POST_GET_AD, paramsMap, httpCallback);
    }

    /**
     * 开屏广告点击量
     */
    public static void adClick(int id, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("id", id);
        postHttp(Constants.POST_GET_AD_CLICK, paramsMap, httpCallback);
    }

    /**
     * 获取阅读历史
     *
     * @param httpCallback
     */
    public static void getHistory(int page, HttpCallback<List<HistoryInfo>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", SharedUtils.getString(Constants.USEROPENID));
        paramsMap.put("access_token", SharedUtils.getString(Constants.USERACCESSTOKEN));
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_GET_HISTORY, paramsMap, httpCallback);
    }

    /**
     * 清除阅读历史
     *
     * @param httpCallback
     */
    public static void clearHistory(HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", SharedUtils.getString(Constants.USEROPENID));
        paramsMap.put("access_token", SharedUtils.getString(Constants.USERACCESSTOKEN));
        postHttp(Constants.POST_CLEAR_HISTORY, paramsMap, httpCallback);
    }

    /**
     * 定位数据上传
     *
     * @param location  位置信息
     * @param longitude 经度
     * @param latitude  纬度
     */
    public static void positionAdd(String location, double longitude, double latitude, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", SharedUtils.getString(Constants.USEROPENID));
        paramsMap.put("alideviceid", SharedUtils.getString(Constants.USERDEVICEID));
        paramsMap.put("location", location);
        paramsMap.put("longitude", longitude);
        paramsMap.put("latitude", latitude);
        postHttp(Constants.POST_POSITION_ADD, paramsMap, httpCallback);
    }

    /**
     * 获取我的评论
     *
     * @param httpCallback
     */
    public static void getMyComment(int page, HttpCallback<List<MyComment>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("uid", SharedUtils.getString(Constants.USEROPENID));
        paramsMap.put("access_token", SharedUtils.getString(Constants.USERACCESSTOKEN));
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_GET_MYCOMMENT, paramsMap, httpCallback);
    }

    /**
     * 优质项目推荐
     *
     * @param httpCallback
     */
    public static void indexProject(HttpCallback<List<NewsOwner>> httpCallback) {
        postHttp(Constants.POST_INDEX_PROJRCT, new LinkedHashMap<String, Object>(), httpCallback);
    }

    /**
     * 首页推荐后台数据接口
     *
     * @param httpCallback
     */
    public static void indexRecommend(HttpCallback<List<SuperInfo>> httpCallback) {
        postHttp(Constants.POST_INDEX_RECOMMEND, new LinkedHashMap<String, Object>(), httpCallback);
    }

    /**
     * 获取创TV详情
     */
    public static void chuangTVDetail(String tvpId, HttpCallback<BusinessDetail> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("id", tvpId);
        postHttp(Constants.POST_CHUANGTV_DETAIL, paramsMap, httpCallback);
    }

    /**
     * 发布文章
     *
     * @param title        文章标题
     * @param content      文章内容
     * @param status       3=提交审核 1=草稿
     * @param id           文章id，大于0表示新增，否则表示修改
     * @param httpCallback
     */
    public static void publishArticle(String title, String content, int status, int id, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("title", title);
        paramsMap.put("content", content);
        paramsMap.put("status", status);
        paramsMap.put("status", status);
        if (id > 0) {
            paramsMap.put("id", id);
        }
        postHttp(Constants.POST_ARTICLE, paramsMap, httpCallback);
    }

    /**
     * App设置
     *
     * @param httpCallback
     */
    public static void getAppConfig(HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_APP_CONFIG, paramsMap, httpCallback);
    }

    public static void getVideoSignature(HttpCallback<String> httpCallback) {
        getHttp(getHttpUrl() + Constants.GET_VIDEO_SIGNATURE, null, httpCallback);
    }

    /**
     * 发布视频
     *
     * @param title        视频标题, 就是"分享你此刻的心情"
     * @param media_id     腾讯云视频id
     * @param media_url    腾讯云返回地址
     * @param media_length 视频长度秒
     * @param httpCallback
     */
    public static void publishVideo(String title, String media_id, String media_url, int media_length, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("title", title);
        paramsMap.put("media_id", media_id);
        paramsMap.put("media_url", media_url);
        paramsMap.put("media_length", media_length);
        postHttp(Constants.POST_VIDEO_SAVE, paramsMap, httpCallback);
    }

    /**
     * 编辑视频
     *
     * @param id           视频id
     * @param title        视频标题, 就是"分享你此刻的心情"
     * @param httpCallback
     */
    public static void editVideo(String id, String title, HttpCallback<Object> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("id", id);
        paramsMap.put("title", title);
        postHttp(Constants.POST_VIDEO_EDIT, paramsMap, httpCallback);
    }

    /**
     * @param status 状态 4=>审核未通过 3=>未审核 1=>审核通过通过 2=>草稿 0<=全部
     * @param page   页码
     */
    public static void myArticle(int status, int page, HttpCallback<List<MyArticleBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("status", status);
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_MY_ARTICLE, paramsMap, httpCallback);
    }

    /**
     * @param status       1=未审核 2=文章退回 3=审核通过 4=审核不通过 0<=全部
     * @param page         页码
     * @param httpCallback
     */
    public static void myVideo(int status, int page, HttpCallback<List<MyArticleBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("status", status);
        paramsMap.put("page", page);
        paramsMap.put("limit", Constants.PAGESIZE);
        postHttp(Constants.POST_MY_VIDEO, paramsMap, httpCallback);
    }

    /**
     * 删除文章
     *
     * @param id
     * @param httpCallback
     */
    public static void deleteArticle(int id, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("id", id);
        postHttp(Constants.POST_DELETE_ARTICLE, paramsMap, httpCallback);
    }

    /**
     * 删除视频
     *
     * @param id
     * @param httpCallback
     */
    public static void deleteVideo(int id, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("id", id);
        postHttp(Constants.POST_DELETE_VIDEO, paramsMap, httpCallback);
    }

    /**
     * 收支明细
     *
     * @param page         页码
     * @param limit        每页条数
     * @param httpCallback
     */
    public static void incomeAndExpenditure(int page, int limit, int category, HttpCallback<List<IncomeExpenditureBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("limit", limit);
        paramsMap.put("page", page);
        paramsMap.put("category", category);
        postHttp(Constants.POST_INCOME_EXPENDITURE, paramsMap, httpCallback);
    }

    /**
     * 查询余额
     *
     * @param httpCallback
     */
    public static void queryBalance(HttpCallback<Integer> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_QUERY_BALANCE, paramsMap, httpCallback);
    }

    /**
     * 绑定支付宝
     *
     * @param accountPhone 电话号码
     * @param name         支付宝名称
     * @param code         验证码
     * @param httpCallback
     */
    public static void bindingAlipay(String code, String accountPhone, String name, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("account_phone", accountPhone);
        paramsMap.put("name", name);
        paramsMap.put("code", code);
        postHttp(Constants.POST_BINDING_ALIPAY, paramsMap, httpCallback);
    }

    /**
     * 提现申请
     *
     * @param type         1=支付宝 2=银行卡 3=微信
     * @param amount       金额
     * @param httpCallback
     */
    public static void withDraw(int type, double amount, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("type", type);
        paramsMap.put("amt", amount);
        postHttp(Constants.POST_WITH_DRAW, paramsMap, httpCallback);
    }

    /**
     * 绑定微信
     *
     * @param code
     */
    public static void bindWeiXin(String code, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("code", code);
        postHttp(Constants.POST_BINDING_WEIXIN, paramsMap, httpCallback);
    }

    /**
     * 微信支付宝是否绑定
     *
     * @param httpCallback
     */
    public static void alipayWeiXinIsBound(HttpCallback<AlipayWeiXinIsBoundBean> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_ALIPAY_WEIXIN_IS_BOUND, paramsMap, httpCallback);
    }

    /**
     * 获取提现账户用户信息
     *
     * @param type
     * @param httpCallback
     */
    public static void getAlipayWxWithDrawInfo(int type, HttpCallback<AlipayWxWithDrawBean> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("type", type);
        postHttp(Constants.POST_ALIPAY_WEIXIN_WITH_DRAW_INFO, paramsMap, httpCallback);
    }

    /**
     * 全部分类列表
     *
     * @param httpCallback
     */
    public static void getAllCategoryList(HttpCallback<List<CategoryBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_ALL_CATEGORY, paramsMap, httpCallback);
    }

    /**
     * 获取项目详情
     *
     * @param id
     * @param page
     * @param limit
     * @param httpCallback
     */
    public static void getBusinessDetails(String id, int page, int limit, HttpCallback<BusinessBean> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("limit", limit);
        paramsMap.put("page", page);
        paramsMap.put("id", id);
        postHttp(Constants.POST_BUSINESS_DETAILS, paramsMap, httpCallback);

    }

    public static void aboutContactUs(HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        getHttp(getHttpUrl() + Constants.POST_ABOUT_CONTACTUS, paramsMap, httpCallback);
    }

    public static void insertScreenAD(HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_INSERTSCREEN_AD, paramsMap, httpCallback);
    }

    public static void getStatisticsPath(long wpid, String pagename, int pageNum, int projectId, int newsId, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();

        paramsMap.put("wpid", wpid);
        paramsMap.put("uv", SharedUtils.getString(Constants.USERDEVICEID, "0"));
        paramsMap.put("jid", SharedUtils.getString(Constants.USEROPENID, "0"));

        paramsMap.put("ip", NetUtils.getNetworkType() == 1 ? NetUtils.getWlanMac() : NetUtils.getMobiMac());

        paramsMap.put("adtag", "0");
        paramsMap.put("source", "0");
        paramsMap.put("page", "0");
        paramsMap.put("pn", pagename);
        paramsMap.put("pt", pageNum);

//        网站路径(APP）页面类型
//                0=默认值
//
//                1=问答
//                2=话题
//                3=资讯
//                4=视频
//                5=培训视频
//                6=培训文章
//
//                101=分享着陆问答
//                102=分享着陆话题
//                103=分享着陆资讯
//                104=分享着陆视频
//                105=分享着陆培训视频
//                106=分享着陆培训文章

        paramsMap.put("iid", projectId);
        paramsMap.put("nid", newsId);
        paramsMap.put("aid", SharedUtils.getString(Constants.USEROPENID, ""));
        paramsMap.put("site", "cyb-android");
        paramsMap.put("ua", getUserAgent());
        paramsMap.put("r", System.currentTimeMillis());

        if (ApkUtils.lacksPermission(Manifest.permission.READ_PHONE_STATE)) {
            paramsMap.put("imei", ApkUtils.getPhoneIMEI());
        }

        getHttp("http://cybapptj.3158.cn/a/0.gif", paramsMap, httpCallback);
    }

    public static void getStatisticsTime(long wpid, long sdt, long edt, HttpCallback<String> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("wpid", wpid);
        paramsMap.put("sdt", sdt);
        paramsMap.put("edt", edt);
        paramsMap.put("r", System.currentTimeMillis());
        getHttp("http://cybapptj.3158.cn/t/0.gif", paramsMap, httpCallback);
    }

    /**
     * 找项目搜索列表页
     *
     * @param keyword      关键词
     * @param catid        分类id
     * @param areaid       地区id
     * @param limit
     * @param page
     * @param httpCallback
     */
    public static void getSearchResultList(String keyword, int catid, int areaid, int limit,
                                           int page, HttpCallback<List<FindProjectListBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        paramsMap.put("keyword", keyword);
        paramsMap.put("catid", catid);
        paramsMap.put("areaid", areaid);
        paramsMap.put("limit", limit);
        paramsMap.put("page", page);
        postHttp(Constants.POST_PROJECT_LIST, paramsMap, httpCallback);
    }

    /**
     * 找项目搜索总部 地址选择
     *
     * @param httpCallback
     */
    public static void getAddrInfo(HttpCallback<List<AddrInfoBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_PROJECT_AREA, paramsMap, httpCallback);
    }

    /**
     * 找项目banner
     *
     * @param httpCallback
     */
    public static void findProjectBanner(HttpCallback<List<FindProjectBannerBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_PROJECT_BANNER, paramsMap, httpCallback);
    }

    /**
     * 找项目推荐
     *
     * @param httpCallback
     */
    public static void findProjectRecommend(HttpCallback<List<FindProjectRecommendBean>> httpCallback) {
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_PROJECT_COMMEND, paramsMap, httpCallback);
    }

    /**
     * 立即评测
     */
    public static void goToEvaluating(HttpCallback<GoToEvaluatingBean> httpCallback){
        LinkedHashMap<String, Object> paramsMap = new LinkedHashMap<>();
        postHttp(Constants.POST_PROJECT_EVALUATINGBEAN, paramsMap, httpCallback);
    }

}